<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="__CSS__/lib/normalize.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/mui-3.6.1.min.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/foods.css" />
    <link rel="stylesheet" href="__CSS__/my_pullrefresh.css" type="text/css">

    <title>分类店铺</title>

</head>
<style type="text/css">
.ptlogo{
    background: -webkit-linear-gradient(left, #ff8c00, #ff5400);
    background: -o-linear-gradient(left, #ff8c00, #ff5400);
    background: -moz-linear-gradient(left, #ff8c00, #ff5400);
    background: linear-gradient(left, #ff8c00, #ff5400);
    padding: 2px 5px;
    font-size: 0.6em;
    color: #fff;
    float: right;
    margin: 0 20px 0 0;
}
</style>
<body>
    <div class="mui-content">
        <div class="top-bar mui-row">
            <div class="return mui-col-sm-2 mui-col-xs-2" onclick="location.href='/Wx/Index/index'"></div>
            <div class="top-middle mui-col-sm-8 mui-col-xs-8">
                <div class="s-top-middle">
                    {$title}
                </div>
            </div>
            <div class="top-right mui-col-sm-2 mui-col-xs-2"></div>
        </div>
    </div>
    <div id="no-goods" style="display:none">
        <div class="my-box">
            <img src="__IMG__/search/box.png"/>
        </div>
        <div class="b-no-cnt">
            <p>抱歉！ 没有找到与 "<span class="no-cnt">没有符合</span>" 店铺或商品</p>
            <p>你可以尝试更换关键词继续搜索</p>
        </div>
    </div>

    <div id="tab">
       <div id="tab-sj-1" class="tab-sj">分类<span class="icon"></span></div>
       <div id="tab-sj-2" class="tab-sj">排序<span class="icon"></span></div>
    </div>

     <!-- 分类 -->
    <div id="tab-classify-cnt">
        <div class="tab-classify">
            <ul id="classify-l">
                    <li data-id="0" class="active">全部<!-- <span class="circle-l circle-active">2526</span> --></li>
                    <foreach name="cate" item="v">
                        <li data-id="{$v['info']['catId']}">{$v['info']['catName']}<span style="display: none;" class="circle-l">{$v['info']['count']|default=0}</span></li>
                    </foreach>
            </ul>
            <div>
                <ul class="classify-r">
                    <li class="active">全部</li>
                </ul>
                <foreach name="cate" item="v">

                <ul class="classify-r">
                    <li class="active" data-id="{$v['info']['catId']}">全部<!-- <span class="circle-r circle-active">2526</span> --></li>
                    <foreach name="v['child']" item="k">
                        <li data-id="{$k['info']['catId']}">{$k['info']['catName']}<span style="display: none;" class="circle-r">{$v['info']['count']|default=0}</span></li>
                    </foreach>
                </ul>
                </foreach>
            </div>
        </div>
    </div>
    <!-- 排序 -->
    <div id="tab-sort-cnt">
        <ul id="sort">
            <li data-type="zhineng" class="sort-active">智能排序<span class="sort-icon sort-active"></span></li>
            <li data-type="juli">距离最近<span class="sort-icon"></span></li>
            <li data-type="qisongjia">起送价最低<span class="sort-icon"></span></li>
            <li data-type="xiaoliang">销量最高<span class="sort-icon"></span></li>
        </ul>
    </div>

    <!-- 商品 -->
    <div id="slider" class="mui-slider mui-fullscreen" style="">
        <div class="mui-slider-group">
            <div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
                <div class="mui-scroll-wrapper">
                    <div class="mui-scroll">
                        <ul id="view" class="mui-table-view">
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="__JS__/jquery2.1.1.min.js"></script>
    <script type="text/javascript" src="__JS__/mui.js"></script>
    <script src="__JS__/mui.pullToRefresh.js"></script>
    <script src="__JS__/mui.pullToRefresh.material.js"></script>
    <script type="text/javascript" src="__JS__/foods.js"></script>
    <!-- <script type="text/javascript" src="__JS__/search_pullrefresh.js"></script> -->
    <script type="text/javascript" src="__JS__/jquery.cookie.js"></script>
     <script type="text/javascript">
    function fdd(obj,value){
    if(!$(obj).hasClass("disable")){
        $(obj).data("isMoved", 0);
        // console.log(0)
    }
    $(obj).one("touchmove", function(e) {
        if(!$(obj).hasClass("disable")){
            $(obj).data("isMoved", 1);
            // console.log(1)
        }
    });
    $(obj).one("touchend", function(e) {

        if(!$(obj).hasClass("disable") && $(obj).data("isMoved") == 0){
            window.location.href ="/Wx/Shop/shop?id="+value+"";

        }
    });
}
    <if condition="$catId">
      var lei = {$catId};
    <else/>
      var lei=0; //分类
    </if>
    var paixu='zhineng'; //排序
    var shaixuan=0; //筛选
    // var longitude=0, latitude=0;
    // baiduMap();



    var longitude=0, latitude=0;
     <if condition="$lat">
     longitude = {$lon};
     latitude = {$lat};
     getShops();
     </if>

    function getShops(){
      var data={
            lat: latitude,
            lon: longitude,
            lei: lei,
            paixu: paixu,
            shaixuan: shaixuan,
            key:$('#serachValue').val()
        };
      $.getJSON('/Wx/Shop/getShop',data,function(data){
        var html='';

        if(data){
        $.each(data,function(i,n){
          var score = Math.floor(n['score']);

            html+='  <a class="mui-table-view-cell" ontouchstart="fdd(this,'+n['shopId']+')" href="/Wx/Shop/shop?id='+n['shopId']+'">';

            html+='    <div class="mui-content-2">';
            html+='          <div class="gg  mui-col-xs-3">';
            html+='              <div class="ufo-2" style="background-image:url(\'/'+n['shopImg']+'\')"></div>';
            html+='          </div>';
            html+='          <div class="gg mui-col-sm-6 mui-col-xs-6">';
            html+='               <div class="yzg">'+n['shopName']+'</div>';
            html+='               <div class="star">';
            for(var i=1;i<=5;i++){
                if(i<=score){
                    html+='<img src="__IMG__/icon_star_1@2x.png" width="100%" height="100%">';
                }else if(n['score']*1+0.5>=i){
                    html+='<img src="__IMG__/icon_star_05@2x.png" width="100%" height="100%">';
                }else{
                    html+='<img src="__IMG__/icon_star_0@2x.png" width="100%" height="100%">';

                }
            }
            html+='                   <span>'+(n['score'])+'</span>月售'+n['yue_xiaoliang']+'份';
            html+='               </div>';
            html+='               <div class="y-time">预计送达时间: <span>'+n['deliveryCostTime']+'</span>分钟 / '+n['juli2']+'</div>';
            if(n['deliveryType'] != 1){
                html+='               <div class="b-you">';
                html+='                   <img src="__IMG__/icon_baoyou@2x.png"/>满'+n['deliveryFreeMoney']+'包邮';
                html+='               </div>';
            }

            html+='          </div>';
            html+='          <div class="gg mui-col-sm-2 mui-col-xs-2">';
            html+='              <p class="qsf"><span class="q-sf">'+n['deliveryStartMoney']+'</span>元起送</p>';
            html+='              <p class="psf"><span>'+n['deliveryMoney']+'</span>元配送费</p>';
            html+='          </div>';
            if(n['deliveryType'] == 1){
            html+='<span class="ptlogo">跑腿专送</span>';
            }

            html+='      </div>';
            html+='  </a>';
        })
        $('#no-goods').hide();
        $('#view').html(html);
      }else{
        $('#view').html('');
        $('#no-goods').show();
      }
    })
    }

</script>

<if condition="$load == 1">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=BLLEya4O2uCtPVA9WWtD6tCUyyYRThrN"></script>
<script type="text/javascript" src="/Tpl/wx/js/convertor.js"></script>
<script type="text/javascript" src="__JS__/baiduMap.js"></script>
</if>

</body>

</html>
